Add a new field to CompileOptions and BuildConfig: `target_rustc_args`
authorSondre Lefsaker <sondrele@stud.ntnu.no>
Fri, 1 May 2015 21:47:07 +0000 (23:47 +0200)
committerSondre Lefsaker <sondrele@stud.ntnu.no>
Fri, 1 May 2015 22:22:36 +0000 (00:22 +0200)
- The new field is a list with arguments to compile the target with.
- There should only be one target that gets compiled with these arguments

src/bin/bench.rs
src/bin/build.rs
src/bin/doc.rs
src/bin/run.rs
src/bin/rustc.rs
src/bin/test.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/cargo_rustc/mod.rs

index ec5e92722998233ad8145c000db6c070de7ed10c..dd5bb5ee564749fb928fe5c45683d75448870c63 100644 (file)
@@ -75,6 +75,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                                             &options.flag_test,
                                             &options.flag_example,
                                             &options.flag_bench),
+            target_rustc_args: None,
         },
     };
 
index cb925510abb34472b767130df0a652658fb08463..3af175ec1b48c1c59f71e2adec221c5581aee332 100644 (file)
@@ -76,6 +76,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                                         &options.flag_test,
                                         &options.flag_example,
                                         &options.flag_bench),
+        target_rustc_args: None,
     };
 
     ops::compile(&root, &opts).map(|_| None).map_err(|err| {
index ed05f9f55b326530065815a8a78cda26e574c6bb..bd1127e2fe5168aa1b831122f1da013c20ab62f4 100644 (file)
@@ -62,6 +62,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
             mode: ops::CompileMode::Doc {
                 deps: !options.flag_no_deps,
             },
+            target_rustc_args: None,
         },
     };
 
index 9ff8728fa3ab512107ec84ee7fa1fe960dc8d7a5..c34c36be1b47ed11de2a687d4b046972a7da5af2 100644 (file)
@@ -72,6 +72,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                 bins: &bins, examples: &examples,
             }
         },
+        target_rustc_args: None,
     };
 
     let err = try!(ops::run(&root,
index c7de721dbd30aac1097c5e1da53b96a44e2dc701..f3d6fdf9defecf8ab65809fa7aee90cb65d2ca1e 100644 (file)
@@ -85,6 +85,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                                         &options.flag_test,
                                         &options.flag_example,
                                         &options.flag_bench),
+        target_rustc_args: None,
     };
 
     ops::compile(&root, &opts).map(|_| None).map_err(|err| {
index f7a7ba55572e6b121dc571d2c3f905e03bfa121f..6199f917be4558e77c956855f786c51ea37da370 100644 (file)
@@ -79,6 +79,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
                                             &options.flag_test,
                                             &options.flag_example,
                                             &options.flag_bench),
+            target_rustc_args: None,
         },
     };
 
index 6231dcb1d8b9d180cc1b88f6d63078adc8dfac80..38a71dc76d98979d6e1580b22bd27b78c808067a 100644 (file)
@@ -58,6 +58,9 @@ pub struct CompileOptions<'a, 'b: 'a> {
     pub release: bool,
     /// Mode for this compile.
     pub mode: CompileMode,
+    /// The specified target will be compiled with all the available arguments,
+    /// note that this only accounts for the *final* invocation of rustc
+    pub target_rustc_args: Option<&'a [String]>,
 }
 
 #[derive(Clone, Copy, PartialEq)]
@@ -102,7 +105,8 @@ pub fn compile_pkg(package: &Package, options: &CompileOptions)
                    -> CargoResult<ops::Compilation> {
     let CompileOptions { config, jobs, target, spec, features,
                          no_default_features, release, mode,
-                         ref filter, ref exec_engine } = *options;
+                         ref filter, ref exec_engine,
+                         ref target_rustc_args } = *options;
 
     let target = target.map(|s| s.to_string());
     let features = features.iter().flat_map(|s| {
@@ -168,6 +172,7 @@ pub fn compile_pkg(package: &Package, options: &CompileOptions)
         let mut build_config = try!(scrape_build_config(config, jobs, target));
         build_config.exec_engine = exec_engine.clone();
         build_config.release = release;
+        build_config.target_rustc_args = target_rustc_args.map(|a| a.to_vec());
         if let CompileMode::Doc { deps } = mode {
             build_config.doc_all = deps;
         }
index 0392580a8ca82e94642a3c83323675ebe22fc036..892512d543a224d3da5285397effff73fa61c3f9 100644 (file)
@@ -189,6 +189,7 @@ fn run_verify(config: &Config, pkg: &Package, tar: &Path)
         exec_engine: None,
         release: false,
         mode: ops::CompileMode::Build,
+        target_rustc_args: None,
     }));
 
     Ok(())
index e1535bb8f3e0d72b4276b16388c910530da148f2..4cb5f5b9b18c5fb840c0603b3e4f490efcb574b7 100644 (file)
@@ -43,6 +43,7 @@ pub struct BuildConfig {
     pub exec_engine: Option<Arc<Box<ExecEngine>>>,
     pub release: bool,
     pub doc_all: bool,
+    pub target_rustc_args: Option<Vec<String>>,
 }
 
 #[derive(Clone, Default)]